-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.

local fs = require "nixio.fs"

local f = SimpleForm("devauth",
	translate("Basemaster - 配置管理"),
	translate("在此处可以对采集程序配置进行管理."))

local o = f:field(Value, "_custom")

o.template = "cbi/tvalue"
o.rows = 20

function o.cfgvalue(self, section)
	return fs.readfile("/etc/base_master.cfg")
end

function o.write(self, section, value)
	value = value:gsub("\r\n?", "\n")
	fs.writefile("/etc/base_master.cfg", value)
	require("luci.sys").call("killall -9 base_master && base_master")
end

f.submit = translate("保存配置并重启程序")

return f
